﻿using MQTTnet.Protocol;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Xps.Serialization;

namespace WPF_MQTT.Models
{
    public class QosModel:BindableBase
    {

        public QosModel(string name, MqttQualityOfServiceLevel qos, bool isChecked = false)
        {
            this.Name = name;
            this.QoS = qos;
            this.IsChecked = isChecked;
        }

        private bool isChecked;

        public bool IsChecked
        {
            set {
                SetProperty(ref isChecked, value);
            }
            get { return isChecked; }
        }

        public string Name { private set; get; }

        public MqttQualityOfServiceLevel QoS { private set; get; }

        public static List<QosModel> Init()
        {
            var result = new List<QosModel>
            {
                new QosModel("至多一次", MqttQualityOfServiceLevel.AtMostOnce, true),
                new QosModel("至少一次", MqttQualityOfServiceLevel.AtLeastOnce),
                new QosModel("只有一次", MqttQualityOfServiceLevel.ExactlyOnce)
            };

            return result;
        }
    }
}
